package com.dianping.cat.home.alert.summary.transform;
import com.dianping.cat.home.alert.summary.entity.Alert;
import com.dianping.cat.home.alert.summary.entity.AlertSummary;
import com.dianping.cat.home.alert.summary.entity.Category;
import java.util.ArrayList;
import java.util.List;

public class DefaultLinker implements ILinker {
  private boolean m_deferrable;

  public DefaultLinker(boolean deferrable) {
/* 12 */     this.m_deferedJobs = new ArrayList();


/* 15 */     this.m_deferrable = deferrable;
  }
  private List<Runnable> m_deferedJobs;
  public void finish() {
/* 19 */     for (Runnable job : this.m_deferedJobs) {
/* 20 */       job.run();
    }
  }


  public boolean onAlert(Category parent, Alert alert) {
/* 26 */     parent.addAlert(alert);
/* 27 */     return true;
  }


  public boolean onCategory(final AlertSummary parent, final Category category) {
/* 32 */     if (this.m_deferrable) {
/* 33 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 36 */               parent.addCategory(category);
            }
          });
    } else {
/* 40 */       parent.addCategory(category);
    }

/* 43 */     return true;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/alert/summary/transform/DefaultLinker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */